package com.ultrawise.survey.module.surevybase.service;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ultrawise.survey.core.base.BaseService;
import com.ultrawise.survey.core.base.ServiceException;
import com.ultrawise.survey.module.surevybase.dao.TSurveyDataAnswerDAO;

@Service("tSurveyDataAnswerService")
public class TSurveyDataAnswerService extends BaseService {
	@Autowired
	TSurveyDataAnswerDAO tSurveyDataAnswerDAO;

	// 对t_survey_data_answer的AS_CHOOSE字段的拼接及查询
	public List<Map<String, Object>> queryPersonnuByquestion(String syid) {
		String sql = "select group_concat(AS_CHOOSE separator '|') as AS_CHOOSE,QN_ID from t_survey_data_answer where SY_ID="
				+ syid + " GROUP BY QN_ID";
		List<Map<String, Object>> byq = tSurveyDataAnswerDAO.queryBysql(sql);
		return byq;
	}
	public void deleAnswerByQuestionId(Integer qnid) throws ServiceException{
		String sql = "delete from  t_survey_data_answer where QN_ID=" + qnid;
		tSurveyDataAnswerDAO.execute(sql);
	}
}
